…might be more clever with a QStringRef, but this is hardly a
performance path.
static void
xcsv_parse_style_buff(const char* sbuff)
{
- // FIXME: should not be a static buf. Should not be a raw character
- // buffer at all!
- char ibuf[4096];
-
- while (*sbuff) {
- ibuf[0] = 0;
- size_t i = 0;
- char* ibufp;
- for (ibufp = ibuf; *sbuff != '\n' && i++ < sizeof(ibuf);) {
- *ibufp++ = *sbuff++;
- }
- while (*sbuff == '\n' || *sbuff == '\r') {
- sbuff++;
- }
- *ibufp = 0;
- xcsv_parse_style_line(ibuf);
+ QStringList lines = QString(sbuff).split('\n');
+ for (const auto& line : lines) {
+ xcsv_parse_style_line(line);
}
}